#ifndef TILEMAP_H_INCLUDED
#define TILEMAP_H_INCLUDED

#include <SFML/Graphics.hpp>
#include <vector>
#include "tile.h"

class TileMap : public sf::Drawable, public sf::Transformable
{



public:
    TileMap(int tileSize, sf::Vector2f position, sf::Vector2f dimesions, sf::Texture* texture);
    void resetTileMap(int);
    void setLayerTexture(unsigned int, int, int, int);
    sf::Vector2f getWorldDimensions();   //returns the size of the world
    void makeDiamond(int, int, sf::Vector2i);
    void makeSquare(int, int, sf::Vector2i);
    int getTileType(unsigned int, int layer);  //returns the tile type for the selected tile
    void smoothEdges(int, int, int, int);   //tile, textureID, source layer, target layer
    void setTileTransparency(unsigned int layer, unsigned int tempTileNumber, unsigned int trans);  //change transparency
    void exploreTile(sf::Vector2f);
    bool isExplored(sf::Vector2f);
    unsigned int getTileNumber(sf::Vector2f);    //returns the tile at a point
    unsigned int getTotalTiles();
    sf::FloatRect getTileRect(unsigned int);    //returns the tile rect
    int getMapTileWidth();
    sf::Vector2f getWorldMapCenter();
    sf::Vector2f getMapPosition();
    sf::Vector2f getTileCenter(unsigned int);   //returns the position of the tile center
    sf::RectangleShape getWalkBounds(); //returns the tileMap walk rectangle

private:

    sf::VertexArray baseLayer;
    sf::VertexArray middleLayer;
    sf::VertexArray fogLayer;
    sf::Texture* m_tileset;

    int mapWidth;
    int mapHeight;

    sf::Vector2f mapPosition;

    sf::RectangleShape walkBounds;

    std::vector<tile*> tiles;

    sf::Vector2f tileSize;
    sf::Vector2u textureTileSize;
    virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;

};

#endif // TILEMAP_H_INCLUDED
